for (var i =2; i <=10000; i++){
  if (i == 2 || i == 3)
      console.log(i + " is a  prime number");
  else {
    var num = parseInt(i / 2);
    while (num > 1){
      if (i % num == 0)
          break;
      if (num == 2)
          console.log(i + " is a  prime number");
      num -= 1;
    }
  }
}